package com.boot.config;

import com.boot.interceptor.LoginInteceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class InterceoptorConfig implements WebMvcConfigurer {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new LoginInteceptor())//添加拦截器
                .addPathPatterns("/**")//所有请求都拦截
                .excludePathPatterns("/login","/doLogin","/register","/doRegister","/*.js");//排除一些不需要拦截的
    }
}
